<template>
  <div>
    组件一
    <p>{{ msg }}</p>
    <p >{{ post.title }}</p>
    <button @click="changeColor" type="button">改变颜色</button>
    <child-two ref="childRefTwo"></child-two>
    <hr>
  </div>
</template>
<script setup>
  import childTwo from "./child2.vue";
  import {ref} from 'vue'
const props = defineProps({
  msg: {
    type: String,
    require: true,
    defalut: "默认的",
  },
  post: {
    type: Object,
    defalut: () => {},
  },
});
const childRefTwo = ref();

const emit = defineEmits(['change'])

const changeColor = ()=>{
  emit('change','red')
}

const postMsg = ()=>{
  console.log('msg ooook')
}

defineExpose({
    postMsg,
    childRefTwo
  })
</script>